package one.stand.service;

import one.stand.OneFileServiceApplicationTests;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

public class OSS extends OneFileServiceApplicationTests {
    @Autowired
    private OssService ossService;
    @Autowired
    private OssUtil ossUtil;

    @Test
    public void f() {
        File file = new File("D://12312.jpg");
        ossUtil.uploadObjectOSS(null);
    }

    @Test
    public void fileTest() throws IOException {
        File file = new File("D://12312.jpg");
        FileInputStream inputStream=new FileInputStream(file);
        MultipartFile f=new MockMultipartFile(file.getName(),inputStream);
        ossService.upload(f);
    }
}
